//构建导航条的状态模块
// import Vue from "vue"
const priceModule = {//下单全局
  namespace: true,
  state: {
    shopNum: 0,//下单数量
    totalPrice: 0,//总价格
    totals: [],//存储购物信息
  },
  mutations: {
    changeShopNum (state, num) {//下单数量
      state.shopNum = num;
    },
    changeTotals (state, info) {//存储购物信息
      state.totals = info;
    },
    changeTotalPrice (state, pri) {
      state.totalPrice = pri;
    }
  },
  actions: {},
}

const navModule = {
  namespace: true,
  state: {
    // titles: '首页',
    // leftShow: true,
    // rightName: "",
    // tabShow: false,
    // titleName: "",
    // leftName: "",
    indesInfo: [],
    indesaddr: [],
    narShow: true,//显示nar
    remark: {},
    rest: [],
  },
  mutations: {
    changeTotals (state, info) {
      state.totals = info;
    },
    rest (state, info) {
      state.rest = info;
    },
    changeNarShow (state, info) {
      state.narShow = info;
    },
    changeTitle (state, titles) {
      state.titles = titles;
    },
    remark (state, remark) {
      state.remark[remark.key] = remark.value;
    },
    changeremark (state) {
      state.remark = {}
    },
    addLocalStorage (state, name) {
      state.indesInfo = name;
    },
    changeLeft (state, leftShow) {
      state.leftShow = leftShow;
    },
    changeAddr (state, indesaddr) {
      state.indesaddr = indesaddr;
    },
    changeRightName (state, iconName) {
      state.rightName = iconName;
    },
    changeTabShow (state, flag) {
      state.tabShow = flag;
    },
    changeTitleName (state, name) {
      state.titleName = name;
    },
    changeLeftName (state, name) {
      state.leftName = name;
    },
  },
}

const tabModule = {
  namespace: true,
  state: {
    tabIndex: 0,
  },
  mutations: {
    changeTabIndex (state, index) {
      state.tabIndex = index;
    },
  },
  actions: {},
}

export default { navModule, tabModule, priceModule };
// export default {nav:navModule,tab:tabModule};